init()
{
    thread SayAll();
    thread Freezeme();
    thread unFreezeme();
}

SayAll()
{
    setdvar("sayall", "");

    while(1)
    {
        wait 0.5;

        if(getdvar("sayall") != "")
        {
            message = getdvar("sayall");
            setdvar("sayall", "");
            iprintlnbold(message);
        }
    }
}

Freezeme()
{
    level endon( "game_ended" );

    for(;;)
    {
        setdvar("freeze", "");

        while( getdvar("freeze") == "" )
            wait .5;

        thisPlayerNum = getdvarint("freeze");
        setdvar("freeze", "");

        players = getentarray("player", "classname");
        for( i=0; i<players.size; i++ )
        {
            if( players[i] getEntityNumber() == thisPlayerNum && players[i].pers["team"] != "spectator" )
            {
                players[i] thread Freeze();
                break;
            }
        }

        wait .5;
    }
}

Freeze()
{
    self endon("disconnect");

    self freezeControls( true );
    iprintln ( self.name + " ^1Has been frozen by an admin.");
}

unFreezeme()
{
    level endon( "game_ended" );

    for(;;)
    {
        setdvar("unfreeze", "");

        while( getdvar("unfreeze") == "" )
            wait .5;

        thisPlayerNum = getdvarint("unfreeze");
        setdvar("unfreeze", "");

        players = getentarray("player", "classname");
        for( i=0; i<players.size; i++ )
        {
            if( players[i] getEntityNumber() == thisPlayerNum && players[i].pers["team"] != "spectator" )
            {
                players[i] thread unFreeze();
                break;
            }
        }

        wait .5;
    }
}

unFreeze()
{
    self freezeControls( false );
    iprintln ( self.name + " ^1Has been unfrozen by an admin.");
}
